<template>
	<view class="reuse">
		<view class="context">
			<template v-if="type==1">
				<view class="title">信息</view>
			</template>
			<template v-if="type==2">
				<view class="wx" ><view>微信：{{linkman.linkmanWx3}}</view><view><u-tag @click="copy(linkman.linkmanWx3)" text="复制" plain size="mini"></u-tag></view>  </view>
				<view class="wx" ><view class="">
					手机：{{linkman.linkmanPhone3}}
				</view>
				<view><u-tag @click="copy(linkman.linkmanPhone3)" text="复制" plain size="mini"></u-tag></view>
				</view>
			</template>
		</view>
	</view>
</template>

<script>
	import{getlinkman} from "@/api/index.js"
	export default {
		data() {
			return {
				type:1,
				linkman:{}
			}
		},
		onLoad(options) {
			let app = getApp();
			 this.userLoginFlag = app.globalData.userLogin;
				console.log(app.globalData.userLogin);
			if (options.type == 1) {
							this.type=options.type
							uni.setNavigationBarTitle({
								title: '关于我们'
							});
						}else{
							this.getlinkmans()
							this.type=options.type
							uni.setNavigationBarTitle({
								title: '联系我们'
							});
						}
		},
		methods: {
			async getlinkmans(){
				const{
					data,
					status,
					msg
				} = await getlinkman()
				this.linkman = data
				
			},
			copy(value) {
				//提示模板
				uni.showModal({
					content: value, //模板中提示的内容
					confirmText: '复制内容',
					success: () => { //点击复制内容的后调函数
						//uni.setClipboardData方法就是讲内容复制到粘贴板
						uni.setClipboardData({
							data: value, //要被复制的内容
							success: () => { //复制成功的回调函数
								uni.showToast({ //提示
									title: '复制成功'
								})
							}
						});
					}
				});
			},
		},
			
	}
</script>

<style lang="scss">
	page{
		min-height: 100vh;
		background-color: #4f4a73;
	}
.reuse {
		min-height: 100vh;
		background-color: #4f4a73;
	}
	.context{
		background-color: #fff;
		width: 95%;
		margin: 40rpx auto;
		border-radius: 25rpx;
		padding: 20rpx;
		box-sizing: border-box;
		.title{
			font-size: 48rpx;
			font-weight: 700;
		}
	}
	.wx{
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}
</style>
